package com.loyal.loyalerp.converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class DateConverter implements Converter<String,Date> {

	@Override
	public Date convert(String source) {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		sdf.setLenient(true);
		Date date=null;
		try {
			date = sdf.parse(source);
		} catch (ParseException e) {
//			e.printStackTrace();
		}
		return date;
	}

}
